function setAndGet() {
	var valTemp ,setVal;
	function analysisGet(strs){
		var that = this;
		var temp = that[strs.shift()];
		if(temp){
			valTemp=temp;
			analysisGet.call(temp,strs);
		}
	}
	function analysisSet(strs){
		var that = this;
		var temp = strs.shift();
		var valT=null;  
		if(temp){
			if(that[temp]){
				if(!that[temp] instanceof Object){
					that[temp] = {};
				}
			}else{
				that[temp] = {};
			}
			valT = that[temp];
			if(strs.length===0){
				that[temp]=setVal;
			}else{
				analysisSet.call(valT,strs);
			}
		}
	}
	
	this.get = function(str) {
		var that = this;
		analysisGet.call(that,str.split("."));
		return valTemp;
	}
	this.set = function(key, val) {
		var that = this;
		setVal = val;
		analysisSet.call(that,key.split("."));
	}
}


function Person() {
	this.name = "person";
}
Person.prototype = new setAndGet();
function Cat() {
	this.name = "cat";
}
Cat.prototype = new setAndGet();

var p = new Person();
var c = new Person();
console.log(p.get("name"));
console.log(p.get("option.xy.d"));
p.set("ttpod", "ssss");
console.log(p.get("ttpod"));